<!DOCTYPE HTML>
<html>

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>无标题文档</title>
    <script>
    //hasOwnProperty : 看是不是对象自身下面的属性

    function Ba(str) {
        this.name = str ? str : 'baobo';
        this.sayHello = function() {
            alert('hello');
        }
    }

    Ba.prototype.alertA = function() {
        alert(this.name + '-A');
    }


    Ba.prototype.alertB = function() {
        alert(this.name + 'B');
    }

    var ba = new Ba('haha');

    console.log(ba.hasOwnProperty('constructor'));
    console.log(Ba.prototype.hasOwnProperty('constructor'));

    function Ca() {
        this.name = 'lili';
    }

    Ca.prototype = {
        hello: function() {
            console.log('hello world');
        }
    }

    var ca = new Ca();
    console.log(Ca.prototype.hasOwnProperty('constructor'));
    </script>
</head>

<body>
</body>

</html>